const fs = require('fs');
const { Transform } = require('stream');
exports.default = () => {
  const read = fs.createReadStream('index.js');
  const write = fs.createWriteStream('index.js');
  const transform = new Transform({
    transfor: (chunk, encoding, callback) => {
      const input = chunk.toString();
      const output = input.replace(/\s+/g, '').replace(/\/\*.+?\*\//g, '');
      callback(null, output);
    },
  });
  read.pipe(transform).pipe(write);
  return read;
};
